package edu.sctu.jarime.may.day20150525.WorkString;

/**
 * Created by user19 on 2015/5/25.
 */
//string类里面的方法的运用
public class WorkString {
    //返回字符串对象包含的字符数。
    public int lenght(String array){
        int len=array.length();
        System.out.println(len);
        return len;
    }


    //两个字符串相加
    public String sub(){
        String   string="array"+"new";
        System.out.println(string);
        return string;
    }

    //取出字符串中某一下标的字母
    public char aChar(int index){
        String  string="hello";
        System.out.println(string.charAt(index));
        return string.charAt(index);
    }

    //取出子串
    public String asubstring(){
        String string="I Love You";
        string.substring(2,7);
        string.substring(2);
        System.out.println( string.substring(2,7));
        System.out.println( string.substring(2));
        return string.substring(2,7)+string.substring(2);
    }

}
